date=$(date +'  %A of Week %V, %Y-%m-%d |  %I:%M:%S %p')
bat=$(cat /sys/class/power_supply/BAT1/capacity)
# cpu=$(mpstat | awk 'NR==4 {print 100-$13 "%"}')
# mem=$(free | awk 'NR==2 {print (1-$7/$2)*100.0 "%"}')

# on_ac_power
on_ac_power=$(cat /sys/class/power_supply/ACAD/online)

if [ $on_ac_power = 1 ]
then
	bat_icon=""
else 
	bat_icon=""
fi

volume=$(amixer -c 1 get Master | sed -n "s/^.*\[\(0\|\([1-9][0-9]*\)\)%\].*$/\1/p")

if [ $bat -le 10 ] 
then
    bat_status="🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘 %s 🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘"
    (paplay ~/.config/sway/battery-dying.mp3) &
    # (zenity --warning --text="Battery Dying!!!!") &
else
    bat_status="%s"
fi

printf "| %s | $bat_status | %s |" "$date" "$bat_icon $bat%" "墳 $volume%"
